cmd/anubis: allow setting key bytes in flag/envvar#97
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables setting ed25519 signing keys via a flag or environment variable while updating documentation and deployment configuration. Key changes include:
- Adding a React component that generates and displays a random key with a refresh button.
- Introducing a new flag (and associated logic) in the Go code to load or generate ed25519 keys.
- Updating the CHANGELOG and deployment manifest with the corresponding new functionality and image tag.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/src/components/RandomKey/index.tsx | Added a component to generate and refresh a random signing key. |
| docs/docs/CHANGELOG.md | Updated the changelog to include details about the new key setting option. |
| cmd/anubis/main.go | Integrated key loading/generation logic with flag support and error handling. |
| lib/anubis.go | Updated the New function to incorporate optional ed25519 key usage. |
| docs/manifest/deployment.yaml | Changed the image tag from "latest" to "main". |
Files not reviewed (1)
- docs/docs/admin/installation.mdx: Language not supported
There was a problem hiding this comment.
Pull Request Overview
This PR enables setting the ED25519 private key via a flag or environment variable, while updating both key generation logic and documentation accordingly.
- Added a React component for displaying and regenerating a random key in the docs.
- Introduced a new flag (and corresponding environment variable) to allow specifying the ED25519 private key in hex format and updated key handling in both cmd and lib.
- Updated the CHANGELOG and deployment manifest to reflect these changes.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/src/components/RandomKey/index.tsx | Added a component that generates and displays a random key with a refresh button. |
| cmd/anubis/main.go | Added flag handling for an ED25519 private key in hex and incorporated key conversion logic with appropriate logging for key generation. |
| docs/docs/CHANGELOG.md | Documented the new flag functionality and key handling behavior. |
| lib/anubis.go | Refactored key generation to use an optional provided private key via options. |
| docs/manifest/deployment.yaml | Updated the image tag reference from latest to main. |
Files not reviewed (1)
- docs/docs/admin/installation.mdx: Language not supported
Comments suppressed due to low confidence (2)
docs/src/components/RandomKey/index.tsx:12
- [nitpick] Consider using the primitive type 'string' instead of 'String' for consistency with TypeScript best practices.
export const genRandomKey = (): String => {
docs/src/components/RandomKey/index.tsx:22
- [nitpick] Consider using 'string' instead of 'String' in the useState generic type to avoid unintended behavior with boxed type objects.
const [key, setKey] = useState<String>(genRandomKey());
ryanccn
left a comment
There was a problem hiding this comment.
Not exactly sure why the refresh button is currently implemented in this roundabout fashion, but I feel like using useCallback (or even just a plain function) would be a more efficient way of updating the random key.
Docs are updated to generate a random key on load and when people press the recycle button. Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Signed-off-by: Xe Iaso <me@xeiaso.net>
e43e487 to
2e080d2
Compare
* cmd/anubis: allow setting key bytes in flag/envvar Docs are updated to generate a random key on load and when people press the recycle button. Signed-off-by: Xe Iaso <me@xeiaso.net> * review feedback fixups Signed-off-by: Xe Iaso <me@xeiaso.net> * Update cmd/anubis/main.go Signed-off-by: Xe Iaso <me@xeiaso.net> * Apply suggestions from code review Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Docs are updated to generate a random key on load and when people press the recycle button.
Closes #70
Closes #32
Checklist:
[Unreleased]section of docs/docs/CHANGELOG.md